Skip to content

Follow-ups for #4014 #4023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

jkczyz
Copy link
Contributor

@jkczyz jkczyz commented Aug 20, 2025

Addresses outstanding comments from #4014.

jkczyz added 5 commits August 20, 2025 11:04
When the current holder commitment point is unavailable for a channel,
we can't splice the channel. Make sure to disconnect so that the channel
is no longer quiescent. Otherwise, it cannot be used for payments.
When introducing HolderCommitmentPoint::current_point, the value was
mistakenly not set when read except in the legacy case where the next
point needed to be fetched. But in that case, it would have been read as
None given it is a new field.
When reading HolderCommitmentPoint, attempt to fetch the current point
if it wasn't serialized. This allows channels to be spliced without
first needing to have the HolderCommitmentPoint advanced. Don't fail if
it can't be fetch synchronously as the channel can still be spliced once
it is advanced.
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Aug 20, 2025

👋 Thanks for assigning @TheBlueMatt as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@jkczyz
Copy link
Contributor Author

jkczyz commented Aug 20, 2025

@TheBlueMatt Should we rename ChannelContext::cur_counterparty_commitment_transaction_number and ChannelContext::counterparty_cur_commitment_point in this PR? Can't recall if we decided those should be "next".

@jkczyz jkczyz force-pushed the splice-initial-commitment-signed-follow-ups branch from 6e1774a to d94baae Compare August 20, 2025 22:36
@jkczyz jkczyz requested a review from TheBlueMatt August 20, 2025 22:36
Copy link

codecov bot commented Aug 20, 2025

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.77%. Comparing base (96f9242) to head (1f8a7d7).
⚠️ Report is 30 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/channel.rs 87.50% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4023      +/-   ##
==========================================
+ Coverage   88.61%   88.77%   +0.15%     
==========================================
  Files         174      175       +1     
  Lines      127640   127895     +255     
  Branches   127640   127895     +255     
==========================================
+ Hits       113113   113539     +426     
+ Misses      12046    11796     -250     
- Partials     2481     2560      +79     
Flag Coverage Δ
fuzzing 22.10% <0.00%> (?)
tests 88.60% <87.50%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

TheBlueMatt
TheBlueMatt previously approved these changes Aug 21, 2025
@@ -6987,7 +6987,7 @@ where
let commitment_point = self
.holder_commitment_point
.current_point()
.expect("current should be set after receiving the initial commitment_signed");
.expect("current_point should be set for channels initiating splicing");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given we have an error option here should we error instead of panicing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I don't mind either way. But is the criteria for doing this simply if the option is available? There is an expect immediately above as well as one below plus an unwrap.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, yea, basically, though in this specific case the only reason this expect is not reachable is because we have a check in the splice-initialization logic and in the splice_init-receive logic. Relying on a single test in another method to avoid a panic kinda sucks, cause who knows what someone is gonna move around in the future. At least for some of the other expects/unwraps around here they're duplicated in many places so hopefully a more robust assumption.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if we should include debug_assert in any of these cases. Otherwise, when reading the code it isn't always easy to determine what is a protocol error vs what is an expectation. Or maybe we make a dedicated ChannelError variant for this, which we can debug_assert elsewhere to keep the code succinct.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can definitely debug_assert. I mean I wasn't really trying to over-complicate this line.

@ldk-reviews-bot
Copy link

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@jkczyz jkczyz force-pushed the splice-initial-commitment-signed-follow-ups branch from d94baae to b0166dd Compare August 21, 2025 14:58
@jkczyz jkczyz requested a review from TheBlueMatt August 21, 2025 14:58
@jkczyz
Copy link
Contributor Author

jkczyz commented Aug 21, 2025

@TheBlueMatt Should we rename ChannelContext::cur_counterparty_commitment_transaction_number and ChannelContext::counterparty_cur_commitment_point in this PR? Can't recall if we decided those should be "next".

@TheBlueMatt Bumping this top-level comment in case you missed it.

@TheBlueMatt
Copy link
Collaborator

Oh sorry I did miss that. I don't have a strong opinion.

TheBlueMatt
TheBlueMatt previously approved these changes Aug 21, 2025
Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this either way, but lmk if you want to make any more changes here.

@jkczyz jkczyz force-pushed the splice-initial-commitment-signed-follow-ups branch from b0166dd to 1f8a7d7 Compare August 21, 2025 20:42
@jkczyz
Copy link
Contributor Author

jkczyz commented Aug 21, 2025

Pushed to fix CI and added the debug_assert while I was at it. Feel free to land if it passes. I can do the other field renames in another PR.

@jkczyz jkczyz requested a review from TheBlueMatt August 22, 2025 16:23
@TheBlueMatt TheBlueMatt merged commit 6f78d57 into lightningdevkit:main Aug 22, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants